// 详细信息模块
const componentBehavior = require('../../../behaviors/component');
const { COMPONENT_OPTIONS } = require('../../../constants/common');
import { getPicFullPath } from '../../../common/utils';
// import { COMMON_PAGE } from '../../../constants/route';

Component({
    behaviors: [componentBehavior],
    options: {
        ...COMPONENT_OPTIONS,
    },
    properties: {
        avatar: {
            type: String,
            value: '',
        },
        useId: {
            type: String,
            optionalTypes: [Number],
            value: '',
        },
        name: String,
        desc: {
            type: String,
            value: '',
        },
        fans: {
            type: Number,
            value: 0,
        },
        activity: {
            type: Number,
            value: 0,
        },
        // 是否是品牌
        isBrand: {
            type: Boolean,
            value: false,
        },
        isHaveEdit: {
            type: Boolean,
            value: true,
        },
        isHaveShare: {
            type: Boolean,
            value: true,
        },
    },
    observers: {
        'avatar': function (pic) {
            this.setData({ avatarUrl: getPicFullPath(pic) });
        },
    },
    data: {
        avatarUrl: '',
    },
    methods: {
        editAction: function () {
            console.log('DetailInfo => 当前传入的id为', this.data);
            this.triggerEvent('edit');
        },
        shareAction: function () {
            this.triggerEvent('share');
        },
    }
})
